/*
 * @FileName: bsp_comp.h
 * @Author: GreyQiu qiushaogui@aikosolar.com
 * @Date: 2023-07-13 10:46:40
 * @LastEditors: GreyQiu qiushaogui@aikosolar.com
 * @LastEditTime: 2023-09-07 11:34:53
 * @Description: 
 * 
 * Copyright (c) 2023, All Rights Reserved. 
 */

#ifndef __BSP_COMP_H__
#define __BSP_COMP_H__
#include "n32g430.h"

#define DAC_RADIO (63.0f / 3.3f) // 1V对应DAC值

// 短路保护电流设置
#define RSENSE_IOUT     0.001f  // 采样电阻值1m欧姆
#define OFFSET_IOUT     7.65f    // 电流采样偏置7.65A
#define GAIN_IOUT       100     // 电流采样放大倍数
#define COMP_SCP_DAC_VAL     ((25.0f + OFFSET_IOUT) * RSENSE_IOUT * GAIN_IOUT) * DAC_RADIO // 电感峰值电流保护25A



void bsp_comp_init(void);
void bsp_comp_enable(void);
void bsp_comp_disable(void);
#endif
